Add Crystal language support#571
Conversation
PR Overview: Add Crystal Language SupportSummaryThis PR adds first-class Crystal language support to Probe, covering parsing, symbol extraction, query/search, language filtering, source context, path detection, and LSP daemon integration. The implementation follows the established pattern used for other languages like Solidity and Ruby. Files Changed Analysis30 files modified with 893 additions and 39 deletions across core Probe CLI and LSP daemon: Core Dependencies:
Documentation:
CLI & Core Language Support:
LSP Daemon Integration (14 files):
NPM Package:
CI Configuration:
Architecture & Impact AssessmentWhat This PR Accomplishes:
Key Technical Changes:
Affected System Components: graph TD
A[Crystal .cr Files] --> B[Parser Pool]
B --> C[tree-sitter-crystal Grammar]
C --> D[Symbol Extraction]
D --> E[CLI Commands]
E --> F[symbols/extract/query/search]
B --> G[LSP Daemon]
G --> H[Language Detector]
H --> I[LSP Registry]
I --> J[crystalline Server]
J --> K[Workspace Resolver]
K --> L[shard.yml/shard.lock]
C --> M[AST Indexing]
M --> N[Symbol Database]
N --> O[FQN Generator]
O --> P[:: Separator]
style A fill:#e1f5ff
style C fill:#fff4e1
style J fill:#ffe1f5
Scope Discovery & Context ExpansionInferred Scope:
Validation Coverage (from PR description):
Notable Patterns:
Recent Updates (from comment history):
ReferencesCore Dependencies:
CLI Integration:
LSP Daemon Integration:
Documentation:
Metadata
Powered by Visor from Probelabs Last updated: 2026-05-31T10:57:08.464Z | Triggered by: pr_updated | Commit: 502c085 💡 TIP: You can chat with Visor using |
Security Issues (7)
Security Issues (7)
No architecture issues found – changes LGTM. ✅ Performance Check PassedNo performance issues found – changes LGTM. ✅ Quality Check PassedNo quality issues found – changes LGTM. Powered by Visor from Probelabs Last updated: 2026-05-31T10:49:17.821Z | Triggered by: pr_updated | Commit: 502c085 💡 TIP: You can chat with Visor using |
3c9b766 to
d0371ef
Compare
|
Addressed the Crystal LSP review follow-up:
Validated with:
|
d0371ef to
502c085
Compare
Summary
HTTP::Serverso they are treated as content terms rather than empty field filters.find_symbol_at_position()resolve Crystal modules, classes, and methods without falling back to keyword/regex paths.Validation
cargo fmt --all -- --checkcargo check -p probe-codecargo check -p lsp-daemoncargo test -p lsp-daemon crystalcargo test -p lsp-daemon language_detectorcargo test -p lsp-daemon lsp_registrycargo test --test crystal_language_testscargo test query::tests::test_crystal_query_supportcargo test search::filters::tests::test_normalize_language_namescargo test search::elastic_query::tests::test_quoted_stringscargo test --test search_hints_tests--language cr,--with-context,--strict-elastic-syntax,--allow-tests,--max-bytes,--max-tokens,--dry-runcargo clippy --all-targets --all-features -- -D warnings,cargo test --lib,cargo test --test integration_testsReal Crystal Dogfood
Validated against an up-to-date local checkout of
https://github.com/crystal-lang/crystal:probe symbols src/compiler/crystal/compiler.crextractedmodule Crystal,class Compiler, enums, nestedCompilationUnit, andcompilemethods.probe query 'def compile' src/compiler/crystal --language crystal --format jsonreturned 4 Crystal method matches acrosscommand.cr,compiler.cr, andinterpreter/compiler.cr.probe query 'def compile' src/compiler/crystal --language cr --max-results 3 --with-context --format jsonaccepted thecralias and returned Crystal query context metadata.probe query 'class Compiler' src/compiler/crystal/compiler.cr --format jsonauto-detected.crand returned the fullclass Compilerblock.probe search 'Crystal::System::Dir AND lang:crystal' . --no-gitignore --max-results 5parsed the namespaced identifier and returned only Crystal files.probe search '"Crystal::System::Dir" AND lang:crystal' . --strict-elastic-syntax --max-results 3 --no-gitignoreverified strict syntax works for quoted Crystal namespaced constants.probe search 'describe AND lang:crystal' spec --max-results 5 --no-gitignore --format jsonreturned zero results by default, while adding--allow-tests --max-bytes 700 --max-tokens 250returned Crystal spec blocks within the requested limits.probe extract src/compiler/crystal/compiler.cr#compile --format plainfound bothcompilemethod definitions.probe extract src/compiler/crystal/compiler.cr:228 --format plainextracted the enclosing method from a line target.probe extract src/compiler/crystal/compiler.cr#compile --dry-run --format plainreported both matching method ranges without returning code.Notes
ParserPool::create_parser()andfind_symbol_at_position()already includecrystalandcrmatch arms. This update adds regression coverage and fixes the adjacent symbol-node/name-resolution gap those paths exposed.crystallinecommand, but the README marks it as install-required because no Crystal LSP server binary is available in this local environment for a live smoke test.crystalline --version,crystal-language-server --version, andcrystal --versionall returncommand not found.